﻿function MoBan_Main(model) {
    return {
        mbid: model ? model.mbid : 0,
        mbmc: model ? model.mbmc : "",
        cjsj: model ? model.cjsj : "",
        cjr: model ? model.cjr : "",
        XingMing: model ? model.XingMing : "",
        mbtype: model ? model.mbtype : 1,
        mbtypename: model ? model.mbtypename:"",
        isuse: model ? model.isuse : true,
        MoBan_Paths: model ? GetPath(model.MoBan_Paths) : []
    };
}

function MoBan_Path(model) {
    return {
        ljid: model ? model.ljid : 0,
        shunxu: model ? model.shunxu : 0,
        ljmc: model ? model.ljmc : "",
        pid: model ? model.pid : 0,
        paths: model ? model.paths : "",
        fenzhi: model ? model.fenzhi : 0,
        isinclude: model ? model.isinclude : false,
        isedit: model ? model.isedit : true,
        ControlID: model ? model.ControlID : 0,
        SonMoBanMain: model ? model.SonMoBanMain : new MoBan_Main(),
        MoBan_Contents: model ? GetContent(model.MoBan_Contents) : []
    };
}
function MoBan_Content(model) {
    return {
        nrid: model ? model.nrid : 0,
        shunxu: model ? model.shunxu : 0,
        nr: model ? model.nr : 0,
        fenzhi: model ? model.fenzhi : 0,
        ControlID: model ? model.ControlID : 0,
        MoBan_Answers: model ? GetAnswers(model.MoBan_Answers) : []
    };
}
function MoBan_Answer(model) {
    return {
        aid: model ? model.aid : 0,
        shunxu: model ? model.shunxu : 0,
        tips: model ? model.tips : "",
        fenzhi: model ? model.fenzhi : 0,
        html: model ? model.html : ""
    }
}
function GetPath(obj) {
    var arr = [];
    $(obj).each(function (i, item) {
        arr.push(new MoBan_Path(item));
    });
    return arr;
}
function GetContent(obj) {
    var arr = [];
    $(obj).each(function (i, item) {
        arr.push(new MoBan_Content(item));
    });
    return arr;
}
function GetAnswers(obj) {
    var arr = [];
    $(obj).each(function (i, item) {
        arr.push(new MoBan_Answer(item));
    });
    return arr;
}